home *** CD-ROM | disk | FTP | other *** search
/ Amoszine 2 / Amoszine 2.adf / AJC-POLLYMORF.AMOS / AJC-POLLYMORF.amosSourceCode next >
AMOS Source Code  |  1992-02-26  |  7KB  |  231 lines

  1. '
  2. '   "POLLYMORF"  
  3. '
  4. '   An irritatingly logical puzzle game by Andrew Campbell   
  5. '   Run the program and press HELP for HELP if you need  
  6. '   instructions on how to play. 
  7. '
  8. '   Please note that this version of the game has no 'LIVES' as such,
  9. '   and you can access any of the 30 levels by simply altering the LVL 
  10. '   variable (you'll see it, I'm sure).
  11. '
  12. '   Files neccessary to run the game are all contained within the  
  13. '   POLYMORF folder on this disk. They are:
  14. '
  15. '   BOBS.POLY - the bob images.      SAMS.POLY - the samples 
  16. '   L1-L30    - the level files      
  17. '
  18. '   There is also a compacted background in bank 15. 
  19. '
  20. '   This game was featured on a "The One" coverdisk! Enjoy it!   
  21. '  
  22.  
  23. Dim MAPXY(15,7),BSX(4),BSY(4)
  24. Global LVL,MAPXY(),X,Y,BALLS_WIPED,BALLS_TO_WIPE,PUSH_BOB,BSX(),BSY(),I,J,FREBOB
  25. '
  26. LVL=1 : FREBOB=13
  27. Dir$="Df0:"
  28. '
  29.  INIT
  30. '
  31. BEGIN:
  32.  STAT
  33.  MAZE
  34.  GAME
  35. Goto BEGIN
  36.  
  37. Procedure INIT
  38.  
  39.  Default Palette 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  40.  Screen Open 0,320,256,32,Lowres : Curs Off : Flash Off : Cls 0 : Hide On 
  41.  Load Dir$+"POLYMORF/BOBS.POLY"
  42.  Load Dir$+"POLYMORF/SAMS.POLY"
  43.  Make Mask 
  44.  Auto View Off 
  45.  Unpack 15 To 1
  46.  Screen Hide 1 : Screen To Back 1
  47.  Screen Copy 1 To 0 : Screen 0
  48.  Auto View On : View 
  49.  Fade 3 To 1 : Wait 15*3
  50.  Double Buffer 
  51.  
  52. End Proc
  53. Procedure MAZE
  54. '
  55. BALLS_TO_WIPE=0 : BALLS_WIPED=0 : PUSH_BOB=0 : X=0 : Y=0 : DEAD_BOB=0
  56. B=$FFF
  57. Palette ,,,,,,,,,,,,,,,,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B
  58.  
  59. Open In 1,Dir$+"POLYMORF/L"+Str$(LVL)-" "
  60. '
  61.  For I=1 To 7
  62.   For J=1 To 15
  63.    Input #1,A
  64.    MAPXY(J,I)=A
  65.  
  66.    If A=1 : Paste Bob 32+16*J,56+16*I,1 : End If 
  67.  
  68.    If A>1 and A<6
  69.     Inc BALLS_TO_WIPE
  70.      Bob 1+BALLS_TO_WIPE,32+16*J,56+16*I,A
  71.    End If 
  72.  
  73.    If A=9 : X=J : Y=I : Bob 1,32+16*J,56+16*I,7 : End If 
  74.  
  75.   Next J
  76.  Next I
  77. '
  78. Close 1
  79. Fade 2 To 1
  80. '
  81. End Proc
  82. Procedure GAME
  83. '
  84. Sam Play 4
  85. Channel 1 To Bob 1
  86. Bob 50,10,20,6
  87. Channel 3 To Bob 50
  88. Amal 3,"M 0,208,"+Str$(1500-LVL*10)
  89. Amal On 3
  90. '
  91. WLP:
  92.  Clear Key 
  93.  Amal 1,"A 0,(7,100)(8,3)(9,3)(10,3)(9,3)(8,3)(7,130)(11,4)(12,4)(13,4)(14,4)(13,4)(12,4)(11,4)" : Amal On 1
  94.  MAPXY(X,Y)=9 : K$=""
  95.  L=0 : R=0 : U=0 : D=0 : PUSH_BOB=0 : DEAD_BOB=0 : GOT_ONE=0
  96.  If BALLS_WIPED=BALLS_TO_WIPE : Sam Play 5 : Inc LVL : B=$FFF : Fade 2,,,,,,,,,,,,,,,,,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B,B : Wait 30 : Bob Off : Screen Swap : Bob Off : Screen Swap 
  97.     Screen Copy 1 To 0 : Screen Swap : Screen Copy 1 To 0 : Screen Swap : Pop Proc : 
  98.  End If 
  99.  Repeat 
  100.  K$=Inkey$
  101.  If Chanmv(3)=0 : Sam Play 1 : Gosub DEDANIM : Bob Off : Screen Swap : Bob Off : Screen Swap : Screen Copy 1 To 0 : Screen Swap : 
  102.   Screen Copy 1 To 0 : Screen Swap : Pop Proc
  103.  End If 
  104.  Until K$<>"" or Joy(1)<>0
  105.  If Asc(K$)=27 : Sam Play 2 : Gosub DEDANIM : Bob Off : Screen Swap : Bob Off : Screen Swap : Screen Copy 1 To 0 : Screen Swap : Screen Copy 1 To 0 : Screen Swap : Pop Proc : End If 
  106.  MAPXY(X,Y)=0
  107.   If Jleft(1) : L=1 : Dec X : Goto MVD : End If 
  108.   If Jright(1) : R=1 : Inc X : Goto MVD : End If 
  109.   If Jup(1) : U=1 : Dec Y : Goto MVD : End If 
  110.   If Jdown(1) : D=1 : Inc Y : Goto MVD : End If 
  111. Goto WLP
  112. '
  113. MVD:
  114.  If MAPXY(X,Y)=1 : Gosub PBACK : Goto WLP : End If 
  115.  
  116.  If MAPXY(X,Y)>1 and MAPXY(X,Y)<6
  117.   For I=1 To BALLS_TO_WIPE
  118.    If 32+16*X=X Bob(I+1) and 56+16*Y=Y Bob(I+1) : PUSH_BOB=I+1 : Goto LAMB : End If 
  119.   Next I
  120. Goto WLP
  121.  
  122.  LAMB:
  123.    If L=1 and MAPXY(X-1,Y)>0 : Gosub PBACK : Goto WLP : End If 
  124.    If R=1 and MAPXY(X+1,Y)>0 : Gosub PBACK : Goto WLP : End If 
  125.    If U=1 and MAPXY(X,Y-1)>0 : Gosub PBACK : Goto WLP : End If 
  126.    If D=1 and MAPXY(X,Y+1)>0 : Gosub PBACK : Goto WLP : End If 
  127.  
  128.    MAPXY(X,Y)=0
  129.    Channel 2 To Bob PUSH_BOB
  130.    If L=1 : MAPXY(X-1,Y)=I Bob(PUSH_BOB) : Amal 2,"M -16,0,8" : End If 
  131.    If R=1 : MAPXY(X+1,Y)=I Bob(PUSH_BOB) : Amal 2,"M 16,0,8" : End If 
  132.    If U=1 : MAPXY(X,Y-1)=I Bob(PUSH_BOB) : Amal 2,"M 0,-16,8" : End If 
  133.    If D=1 : MAPXY(X,Y+1)=I Bob(PUSH_BOB) : Amal 2,"M 0,16,8" : End If 
  134.    Amal On 2
  135.  End If 
  136.  
  137.    If L=1 : Amal 1,"A 1,(17,5) ; M -16,0,8" : End If 
  138.    If R=1 : Amal 1,"A 1,(16,5) ; M 16,0,8" : End If 
  139.    If U=1 : Amal 1,"A 1,(15,5) ; M 0,-16,8" : End If 
  140.    If D=1 : Amal 1,"A 1,(18,5) ; M 0,16,8" : End If 
  141.  
  142.  Amal On 1
  143.  Wait 8
  144.  
  145.  If PUSH_BOB=0 : Goto WLP : End If 
  146.  
  147.  BSX(1)=X Bob(PUSH_BOB)-16 : BSY(1)=Y Bob(PUSH_BOB)
  148.  BSX(2)=X Bob(PUSH_BOB)+16 : BSY(2)=Y Bob(PUSH_BOB)
  149.  BSX(3)=X Bob(PUSH_BOB) : BSY(3)=Y Bob(PUSH_BOB)-16
  150.  BSX(4)=X Bob(PUSH_BOB) : BSY(4)=Y Bob(PUSH_BOB)+16
  151.  
  152.  For I=1 To 4
  153.   For J=1 To BALLS_TO_WIPE
  154.    If BSX(I)=X Bob(J+1) and BSY(I)=Y Bob(J+1) : DEAD_BOB=J+1 : Gosub SHEEP : End If 
  155.   Next J
  156.  Next I
  157.  
  158.  If GOT_ONE>0 : MAPXY((X Bob(PUSH_BOB)-32)/16,(Y Bob(PUSH_BOB)-56)/16)=0 : 
  159.   Sam Play 3
  160.   Channel FREBOB To Bob PUSH_BOB : Amal FREBOB,"A 1,(27,3)(28,3)(29,3)(30,3)" : Amal On FREBOB : Inc FREBOB
  161.   Wait 9 : Bob PUSH_BOB,-16,-16,1 : Wait Vbl : Gosub CHKFREE : Inc BALLS_WIPED : 
  162.  End If 
  163. Goto WLP
  164. '
  165. SHEEP:
  166.  If I Bob(DEAD_BOB)=I Bob(PUSH_BOB)
  167.   GOT_ONE=1 : Inc BALLS_WIPED : Sam Play 3
  168.   MAPXY((X Bob(DEAD_BOB)-32)/16,(Y Bob(DEAD_BOB)-56)/16)=0
  169.   Channel FREBOB To Bob DEAD_BOB
  170.   Amal FREBOB,"A 1,(27,3)(28,3)(29,3)(30,3)" : Amal On FREBOB : Wait 9
  171.   Inc FREBOB : Gosub CHKFREE : Bob DEAD_BOB,-16,-16,1 : Wait Vbl 
  172.  End If 
  173. Return 
  174. '
  175. PBACK:
  176.  If L=1 : Inc X : Return : End If 
  177.  If R=1 : Dec X : Return : End If 
  178.  If U=1 : Inc Y : Return : End If 
  179.  If D=1 : Dec Y : Return : End If 
  180. Return 
  181. '
  182. CHKFREE:
  183.  If FREBOB>15 : FREBOB=13 : End If 
  184. Return 
  185. '
  186. DEDANIM:
  187.  Amal 1,"A 1,(19,3)(20,3)(21,3)(22,3)(23,3)(24,3)(25,3)(26,3)"
  188.  Amal On 1 : Wait 40
  189. Return 
  190. '
  191. End Proc
  192. Procedure STAT
  193. '
  194. RE:
  195.  Paper 0 : Pen 1 : Clear Key : K$=""
  196.  Ink 0 : Bar 79,73 To 242,138
  197. Locate 0,10 : Centre "P O L Y M O R F"
  198. Locate 0,12 : Centre "PUZZLE:"+Str$(LVL)-" "
  199. Locate 0,14 : Centre "PRESS FIRE TO PLAY"
  200.  Repeat : K$=Inkey$ : Until K$<>"" or Fire(1)
  201.  If Scancode=95 : HELP : Goto RE : End If 
  202.  If Asc(K$)=27 : Fade 3 : Wait 15*3 : End : End If 
  203.  Screen Copy 1 To 0 : Screen Swap 
  204.  Screen Copy 1 To 0 : Screen Swap 
  205. '
  206. End Proc
  207. Procedure HELP
  208. '
  209.  Clear Key 
  210.  Screen Copy 1 To 0 : Screen Swap 
  211.  Screen Copy 1 To 0 : Screen Swap 
  212. '
  213.  Paper 0 : Pen 1 : Clear Key : K$=""
  214.  Ink 0 : Bar 14,73 To 300,188
  215.   Locate 0,10 : Centre "...POLYMORF HELP SCREEN..."
  216.   Locate 0,12 : Centre "Wipe each screen of all the balls "
  217.   Locate 0,13 : Centre "pushing identical colours together"
  218.   Locate 0,14 : Centre "using the joystick. There are 30  "
  219.   Locate 0,15 : Centre "levels to complete and you have   "
  220.   Locate 0,16 : Centre "an unlimited amount of attempts.  "
  221.   Locate 0,17 : Centre "The time limit for each screen is "
  222.   Locate 0,18 : Centre "shown on the left. This game is a "
  223.   Locate 0,19 : Centre "simplified version of PARADOX, out"
  224.   Locate 0,20 : Centre "now in the CLR Licenceware range. "
  225.   Locate 0,22 : Centre "PRESS FIRE TO CONTINUE"
  226.  Repeat : K$=Inkey$ : Until K$<>"" or Fire(1)
  227. '
  228.  Screen Copy 1 To 0 : Screen Swap 
  229.  Screen Copy 1 To 0 : Screen Swap 
  230. '
  231. End Proc